<template>
  <div class="dashboard-editor-container">
    <div v-if="!noDreamFound">
    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="20">
        <div class="chart-wrapper">
          <bar-chart />
        </div>
      </el-col>
    </el-row>
    <el-row :gutter="32">
      <el-col :xs="24" :sm="24" :lg="20">
        <div class="chart-wrapper">
          <pie-chart height="600px"/>
        </div>
      </el-col>
    </el-row>
  </div>
  <h1 v-else> No Dream found </h1>
  </div>
</template>

<script>
import PieChart from './components/PieChart'
import BarChart from './components/BarChart'
import { getBriefDream } from '@/api/dreams'

export default {
  components: {
    BarChart,
    PieChart
  },
  data() {
    return {
      noDreamFound: false
    }
  },
  created() {
    // this.fetchPiebarData()
  },
  methods: {
    fetchBriefDream(){
      getBriefDream().then(response => {
        if (!response.data){
          this.noDreamFound = true
        }
      })
    }
   }
}
</script>

<style lang="scss" scoped>
.dashboard-editor-container {
  padding: 32px;
  background-color: rgb(240, 242, 245);
  position: relative;

  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}

@media (max-width:1024px) {
  .chart-wrapper {
    padding: 8px;
  }
}
</style>
